<template>
  <div id="allocate-detail" class="component-wrap">
    <Title :title-msg="titleMsg"></Title>
    <div class="allocate-detail-list" :class=" item.status === '待确认' ? 'no-bottom' : 'has-bottom' ">
      <van-pull-refresh v-model="isLoading" @refresh="onRefresh">
        <Box :item="item"></Box>
        <List v-for="(item,index) in allocateDetailLists" :key="index" :detail-item="item"></List>
      </van-pull-refresh>
    </div>
    <ul class="detail-bottom" v-if="!(item.status === '待确认')">
      <li>全部确认</li>
      <li>扫码确认</li>
      <li>驳回</li>
    </ul>
  </div>
</template>

<script type="text/ecmascript-6">
  import Title from '@/components/common/Title.vue'
  import Box from '@/components/common/AllocateDetailBox.vue'
  import List from '@/components/common/HandleList.vue'
  import { PullRefresh } from 'vant';

  const listItem= {
    "assetCode": "0281219-1223",
    "assetName": "戴尔台式机",
    "assetType": "办公用品",
    "assetGroup": "电脑一体机",
    "assetPosition": "青岛市崂山区松岭路399号"
  }

  export default {
    name: "allocateDetail",
    data:function(){
      return {
        titleMsg: {
          title: "资产调拨单",
          back: true,
          scan: false,
          search: false
        },
        item: {},
        allocateDetailLists: [ listItem, listItem, listItem, listItem ],
        isLoading: false,
      }
    },
    created:function(){
      this.item.exportTime = this.$route.query.exportTime
      this.item.exportOrganization = this.$route.query.exportOrganization
      this.item.exportAdmin = this.$route.query.exportAdmin
      this.item.importOrganization = this.$route.query.importOrganization
      this.item.exportAdmin = this.$route.query.exportAdmin
      this.item.allocateNum = this.$route.query.allocateNum
      this.item.remark = this.$route.query.remark
      this.item.status = this.$route.query.status
    },
    methods: {
      onRefresh:function() {
        setTimeout(() => {
          this.$toast('刷新成功');
          this.isLoading = false;
        }, 500);
      },
      repairEdit:function(){
        this.deleteShow = !this.deleteShow
      }
    },
    components: {
      Title: Title,
      List: List,
      Box: Box
    }
  }
</script>

<style scoped>
  #allocate-detail .allocate-detail-list {
    position: fixed;
    top: 5.5rem;
    left: 0;
    right: 0;
    overflow: auto;
  }
  #allocate-detail .has-bottom {
    bottom: 5rem;
  }
  #allocate-detail .no-bottom {
    bottom: 0;
  }
</style>
